## 模板1
import os

env = None
Enable_Clang = False
# 1.编译器
if Enable_Clang and os.system("which clang") == 0:
    # clang编译器
    env = Environment(tools=["default", "clang"])
    env["CC"] = ["clang"]
    env["CXX"] = ["clang++"]
else:
    env = Environment()

env["PROGSUFFIX"] = ".out"                     # 可执行后缀.out
env["CCFLAGS"] = " -ggdb3 -O0"                 # gdb 调试开关
env["CCFLAGS"] += " -Wall -Wextra -Wpedantic"  # 详细的编译检查 警告

sources=0
ccflags=1
linkflags=2
target_list = [
    "demo.cc",
    # ["源代码","编译参数","链接参数"],
    ["demo.cc","",""],
]
for target in target_list:
    if isinstance(target,(str)):
        env.Program(Split(target))
    elif isinstance(target,(list)):
        env.Program(Split(target[sources]),CCFLAGS=target[ccflags]+env["CCFLAGS"],LINKFLAGS=target[linkflags]+env["LINKFLAGS"])


## 模板2
env = Environment()
env["PROGSUFFIX"] = ".out"                # 可执行后缀.out
env["CCFLAGS"] = ["-g3", "-O0", "-Wall"]  # gdb 调试
env["CCFLAGS"] += " -Wall -Wextra -Wpedantic"  # 详细的编译检查 警告
env.Program("demo.c")